babl: make utility file reading function non-static
authorØyvind Kolås <pippin@gimp.org>
Wed, 13 Sep 2017 13:10:07 +0000 (15:10 +0200)
committerØyvind Kolås <pippin@gimp.org>
Wed, 13 Sep 2017 13:10:31 +0000 (15:10 +0200)
babl/babl-cache.c
babl/babl-internal.h
babl/babl-util.c

index 2b256285d9cb785b2c5df88b1d5355e09a638a01..0200a11c264eb8b2992999d9245a5965f74a1a7d 100644 (file)
@@ -195,45 +195,6 @@ void babl_store_db (void)
   free (tmpp);
 }
 
-static int
-babl_file_get_contents (const char  *path,
-                        char       **contents,
-                        long        *length,
-                        void        *error)
-{
-  FILE *file;
-  long  size;
-  char *buffer;
-
-  file = fopen (path,"rb");
-
-  if (!file)
-    return -1;
-
-  fseek (file, 0, SEEK_END);
-  size = ftell (file);
-  if (length) *length = size;
-  rewind (file);
-  buffer = calloc(size + 8, 1);
-
-  if (!buffer)
-    {
-      fclose(file);
-      return -1;
-    }
-
-  size -= fread (buffer, 1, size, file);
-  if (size)
-    {
-      fclose (file);
-      free (buffer);
-      return -1;
-    }
-  fclose (file);
-  *contents = buffer;
-  return 0;
-}
-
 int
 _babl_fish_path_destroy (void *data);
 
@@ -259,7 +220,7 @@ void babl_init_db (void)
   if (getenv ("BABL_DEBUG_CONVERSIONS"))
     return;
 
-  babl_file_get_contents (path, &contents, &length, NULL);
+  _babl_file_get_contents (path, &contents, &length, NULL);
   if (!contents)
     return;
 
index 7bf05446153843e0ed93c5a95039327ebab5c278..a4dc5f743a86e057a471984fb938868839057bea 100644 (file)
@@ -424,5 +424,9 @@ const Babl * babl_trc_gamma (double gamma);
  */
 const Babl * babl_trc       (const char *name);
 
+int _babl_file_get_contents (const char  *path,
+                             char       **contents,
+                             long        *length,
+                             void        *error);
 
 #endif
index 01a5e978a6211d0a6fa230e99e367ade23b567a4..9b08913676de1094349cf873edf40baddf4687c2 100644 (file)
@@ -99,3 +99,42 @@ babl_rel_avg_error (const double *imgA,
   return error;
 }
 
+int
+_babl_file_get_contents (const char  *path,
+                         char       **contents,
+                         long        *length,
+                         void        *error)
+{
+  FILE *file;
+  long  size;
+  char *buffer;
+
+  file = fopen (path,"rb");
+
+  if (!file)
+    return -1;
+
+  fseek (file, 0, SEEK_END);
+  size = ftell (file);
+  if (length) *length = size;
+  rewind (file);
+  buffer = calloc(size + 8, 1);
+
+  if (!buffer)
+    {
+      fclose(file);
+      return -1;
+    }
+
+  size -= fread (buffer, 1, size, file);
+  if (size)
+    {
+      fclose (file);
+      free (buffer);
+      return -1;
+    }
+  fclose (file);
+  *contents = buffer;
+  return 0;
+}
+